<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;
use app\api\model\Activity;
use app\api\model\Coupon;
use PDO;
use wxpay\wxpay;
use alipay\Alipay;
use epay\epay;

class Banner extends Api
{
    protected $noNeedLogin = ['getBanner'];
    protected $noNeedRight = ['*'];
    /**
     * banner
     * 43367628@qq.com
     */
    public function getBanner()
    {
        $tag = $this->request->get("tag");
        if(!$tag){
            $this->error('参数错误');
        }
        $banner = Db::table('box_banner')->where(['bswitch'=>1,'tag'=>$tag])->order('weigh DESC')->select();
        if (empty($banner)) {
            $this->error('未找到轮播图');
        }
        foreach ($banner as &$banner_v) {
            $banner_v['image'] = cdnurl($banner_v['image'], true);
        }
        $this->success('轮播图数据', $banner);
    }
   
}
